import request from "@/http/request";
import {DynamicRoutes} from "@/router";

//登录接口
export function login(username, password){
    // return request.post('/api/admins/tokens',{username,password});
    return new Promise((resolve,reject) => {
        const resp = {
            status:200,
            token:'qwer'
        }
        if (username==="admin" && password==="admin"){
            resolve(resp)
        }
        reject()
    })
}

// 获取用户信息
export function getInfo(){
    return new Promise((resolve, reject) => {
        const resp = {
            roles:["admin"],
            user:{
                username:'admin',
                name:'万能的魔术菇',
                avatar:'https://img2.baidu.com/it/u=3644579383,1360526475&fm=26&fmt=auto'
            }
        }
        resolve(resp)
    })
}

// 获取用户的路由
export function getRoutes(){
    return new Promise((resolve, reject) => {
        const routes = DynamicRoutes;
        resolve(routes)
    })
}
